package com.itheima.Stream流;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

/**
 * @Author 王加鑫
 * @Date 2021/5/17 11:15
 * @Version 1.0
 */
public class Demo02 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("林青霞","张曼玉","王祖贤","柳岩","张敏","张无忌","张三丰","张翠山"));
        Stream<String> limitStream = list.stream().limit(6);

        Stream<String> skipStream = list.stream().skip(list.size() -3);

        Stream<String> concatSteam = Stream.concat(limitStream,skipStream);

        concatSteam.distinct().forEach(s -> System.out.println(s));






    }
}
